<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>在ob_start中使用的用来压缩输出缓冲区中内容的回调函数。ob_start callback function to gzip output buffer</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ob-gzhandler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ob_gzhandler</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ob_gzhandler</span> &mdash; <span class="dc-title">在ob_start中使用的用来压缩输出缓冲区中内容的回调函数。ob_start callback function to gzip output buffer</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ob-gzhandler-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ob_gzhandler</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$buffer</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>ob_gzhandler()</strong></span>目的是用在<span class="function"><a href="ob_start.html" class="function">ob_start()</a></span>中作回调函数，以方便将gz   编码的数据发送到支持压缩页面的浏览器。在<span class="function"><strong>ob_gzhandler()</strong></span>真正发送压缩过的数据之前，该   函数会确定（判定）浏览器可以接受哪种类型内容编码（&quot;gzip&quot;,&quot;deflate&quot;,或者根本什么都不支持），然后   返回相应的输出。
   所有可以发送正确头信息表明他自己可以接受压缩的网页的浏览器，都可以支持。
   All browsers are supported since it&#039;s up to the browser to send the
   correct header saying that it accepts compressed web pages. 
   如果一个浏览器不支持压缩过的页面，此函数返回<strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ob-gzhandler-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">buffer</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">mode</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ob-gzhandler-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ob-gzhandler-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.0.5</td>
       <td>
        填加了 <code class="parameter">mode</code> 参数。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ob-gzhandler-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-479">
    <p><strong>Example #1 <span class="function"><strong>ob_gzhandler()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />ob_start</span><span style="color: #007700">(</span><span style="color: #DD0000">"ob_gzhandler"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;html&gt;<br />&lt;body&gt;<br />&lt;p&gt;This&nbsp;should&nbsp;be&nbsp;a&nbsp;compressed&nbsp;page.&lt;/p&gt;<br />&lt;/html&gt;<br />&lt;body&gt;</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.ob-gzhandler-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="function"><strong>ob_gzhandler()</strong></span> 需要 <a href="ref.zlib.html" class="link">zlib</a> 扩展。
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    不能同时使用<span class="function"><strong>ob_gzhandler()</strong></span> 和 <a href="zlib.configuration.html#ini.zlib.output-compression" class="link">zlib.output_compression</a>。
    也要注意使用 <a href="zlib.configuration.html#ini.zlib.output-compression" class="link">
    zlib.output_compression</a> 要优于 <span class="function"><strong>ob_gzhandler()</strong></span>。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ob-gzhandler-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ob_start.html" class="function" rel="rdfs-seeAlso">ob_start()</a> - 打开输出控制缓冲</span></li>
    <li class="member"><span class="function"><a href="ob_end_flush.html" class="function" rel="rdfs-seeAlso">ob_end_flush()</a> - 冲刷出（送出）输出缓冲区内容并关闭缓冲</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>